<template>
  <div id="app">
    <header>
      <div class="box">
        <div class="main">
          <div class="logo">
            <img src="../public/picture/logo.png" alt="logo" width="143px" height="43px" />
          </div>
          <nav>
            <ul>
              <li>
                <router-link to="/home">主页</router-link>
              </li>
              <li>
                <router-link to="/products">店<span class="zy-xl"></span></router-link>
                <div class="zy-dian con">
                  <ul>
                    <li>店铺会员</li>
                    <li>店铺单人团</li>
                    <li>店铺</li>
                  </ul>
                </div>
              </li>
              <li>
                <router-link to="/boke">博客 </router-link>
              </li>
              <li>
                <router-link to="/classification">分类<span class="zy-xl"></span></router-link>
                <div class="zy-fl con">
                  <ul>
                    <li>心愿单</li>
                    <li>
                      <router-link to="/shop">购物车</router-link>
                    </li>
                  </ul>
                </div>
              </li>
              <li>
                <router-link to="/contact">联系</router-link>
              </li>
            </ul>
          </nav>
          <div class="header-right">
            <input type="text" placeholder="搜索商品" />
            <button><i class="iconfont icon-sousuo tb"> </i></button>
            <router-link to="/account"><i class="iconfont icon-ren tb" id="user"></i></router-link>
            `<i class="iconfont icon-shangpindaizi tb">
              <span v-show="gw">{{gwcount}}</span>
            </i>
          </div>
        </div>
      </div>
    </header>
    <router-view></router-view>
    <!-- 返回顶部 -->
    <div class="fh-top">
      ^
    </div>
    <footer>
      <div class="box">
        <p>Copyright &copy;2020 by marvinzyx</p>
      </div>
    </footer>
    <!-- 模态框 -->

  </div>
</template>
<style lang="less">
  * {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
  }

  .fh-top {
    // position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 18px;
    width: 500px;
    height: 40px;
    line-height: 40px;
    border-radius: 50%;
    z-index: 99;
    text-align: center;
    display: none;
    transition: 0.4s;
    color: #ffffff;
    background-color: #f34f3f;
  }

  ul,
  li {
    list-style: none;
  }

  a {
    cursor: pointer;
    text-decoration: none;
  }

  button,
  input {
    border: none;
    background: none;
    outline: none;
    cursor: pointer;
  }

  body {
    padding-top: 110px;
    // padding: 114px 0 0 0;
    background-color: #ffffff;
    font-size: 16px;
    line-height: 1.75;
    font-style: normal;
    font-weight: 400;
    visibility: visible;
    font-family: "Rubik", sans-serif;
    color: #666666;
  }

  //返回顶部
  .fh-top {}

  // 模态框
  .modal-dialog {
    padding: 0 20px;
    width: 998px !important;
    height: 646px !important;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-left: -459px;
    margin-top: -323px;
  }

  .modal-body {
    width: 922px;
    height: 576px;
    display: flex;
    justify-content: space-between;
  }

  .modal-body>div {
    width: 450px;
    height: 100%;
    display: flex;
    flex-flow: column;

  }

  .shopping-left {
    margin-bottom: 30px;
    border-bottom: 1px solid #ccc;

    .price {
      font-weight: 500;
      font-size: 23px;
      color: #f34f3f;
      margin-left: 5px;
    }

    .del {
      display: inline-block;
      text-decoration: line-through;
      font-weight: 400;
      font-size: 20px;
      margin-left: 5px;
      color: #222222;
      // background-color: #C8C8C8;
      margin-right: 6px;
    }

    .yl {
      background: #f34f3f;
      color: #fff;
      padding: 3px 16px;
      margin-top: 4px;
      margin-right: 6px;
    }

    h3 {
      font-size: 18px;
      margin-bottom: 8px;
      font-weight: 600;
    }

    .img-3 {
      display: flex;
      justify-content: space-between;
      align-items: center;

      div {
        .visited-red {
          border: 2px solid #f34f3f;
        }

        margin-top: 20px;
      }
    }
  }

  .scn {
    height: 175px;
    margin: 30px 0 16px 0;
    display: flex;
    justify-content: space-between;

    .num {
      font-size: 16px;
      display: flex;
      justify-content: space-between;

      .tj {
        width: 120px;
        height: 42px;
        margin: 10px 30px 0 0;
        display: flex;
        justify-content: space-between;

        input {
          width: 60px;
          height: 40px;
          padding: 0 10px;
        }
      }

      .addto {
        width: 204px;
        height: 40px;
        font-size: 14px;
        background-color: #f34f3f;
        color: #fff;
        font-weight: 600;
      }

    }

  }

  //=====================================================
  header {
    margin-top: -110px;
    width: 100%;
    position: fixed;
    z-index: 999;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.11);

    &:hover {
      background-color: #ffffff;
    }

    .box {
      width: 100%;
      padding: 30px 0;
      color: #666666;

      .main {
        width: 1200px;
        height: 50px;
        margin: 0 auto;
        display: flex;

        .logo {
          width: 16.7%;
          padding: 0 12px;
        }

        nav {
          width: 676px;

          ul {
            width: 100%;
          }

          ul,
          li {
            height: 100%;

            li {
              position: relative;
              color: #222222;
              font-size: 16px;
              list-style: none;
              float: left;
              margin: 0 20px;
              line-height: 50px;

              &:hover div {
                visibility: visible;
                opacity: 1;
                position: absolute;
                z-index: 9999;
                top: 50px;
              }

              .con {
                width: 200px;
                height: 150px;
                position: absolute;
                background: white;
                visibility: hidden;
                opacity: 0;
                left: -20px;
                transition: all linear 0.45s;
                top: 80px;
                z-index: 9999;
                font-size: 15px;
                font-weight: 400;
                line-height: 22px;
                color: #7e7e7e;
                text-transform: capitalize;
                box-shadow: -2px 2px 81px -27px rgba(0, 0, 0, 0.3);

                ul {
                  color: #222222;
                  text-decoration: none;
                  position: relative;

                  li {
                    width: 100%;
                    height: 30px;
                    padding: 5 20px;
                  }
                }
              }

              div {
                width: 400px;
                height: 200px;
              }

              a {
                color: #222222;
                text-decoration: none;
                position: relative;

                .zy-xl {
                  display: inline-block;
                  width: 10px;
                  height: 12px;
                  background: url(../public/image/xl.png);
                  background-size: 10px 16px;
                }
              }
            }
          }
        }

        .header-right {
          width: 300px;
          padding: 0 12px;
          display: flex;
          justify-content: space-around;
          align-items: center;

          button {
            cursor: pointer;
            outline: none;
            border: 0;
            background: none;
            color: #666666;
            height: 40px;
          }

          //购物车模块
          .tb {
            font-size: 20px;
            position: relative;
            // height: 40px;
            font-size: 20px;
            color: #222222;
            font-weight: 400;
            opacity: 0.7;
            padding-right: 32px;
            border: 0;

            span {
              position: absolute;
              top: -5px;
              right: 23px;
              width: 20px;
              height: 20px;
              line-height: 20px;
              background: red;
              border-radius: 100%;
              text-align: center;
              font-weight: 400;
              font-size: 12px;
              color: #ffffff;
            }
          }
        }
      }
    }
  }

  footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 76px;
    font-size: 16px;
    background: #222222;

    .box {
      max-width: 1200px;
      margin: 0 auto;

      p {
        color: #fff;
      }
    }
  }
</style>
<script>
  export default {
    data() {
      return {
        gw: false,
        gwcount: ''
      };
    },
    /*  mounted () {
      this.$axios.get('http://localhost:3000/data').then((data)=>{
        console.log(data)
      }).catch(err);
    } */
    mounted() {
      (function smoothscroll() {
        var currentScroll = document.documentElement.scrollTop || document.body.scrollTop;
        if (currentScroll > 0) {
          window.requestAnimationFrame(smoothscroll);
          window.scrollTo(0, currentScroll - (currentScroll / 5));
        }
      })();
      /*        if (this.$store.state.car.length != 0) {
              this.gw = true;
              this.gwcount =this.$store.state.car.length;
          } */
    }
  };
</script>